package com.symaster.pdfcompose.util;

import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

/**
 * @author yinmiao
 * @version 2024/4/29
 */
public class ComponentUtil {

    public static void addResizeListener(Component component) {
        component.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                component.doLayout();
            }

            @Override
            public void componentMoved(ComponentEvent e) {
                component.doLayout();
            }

            @Override
            public void componentShown(ComponentEvent e) {
                component.doLayout();
            }

            @Override
            public void componentHidden(ComponentEvent e) {
                component.doLayout();
            }
        });
    }

}
